import sys
sys.path.append ('../')
sys.path.append ('../DataMiningPackage')
import data
from data import Data
import DataMiningPackage.NaiveBayes as NB


class TTrainModel ():

    def __init__(self,categorization,mode) -> None:
        self.TT = None
        self.Model = None
        self.OM = None

        self.OM = Data.ObjMemory()
        path = '../data/' + mode + '/TrainText.pkl'
        self.TT = self.OM.LoadObj(path)
        self.data = self.TT.Data
        print ('开始啦')
        self.Model = NB.NaiveBayes (self.data,categorization)

    
    def Analysis (self,sample):
        r = self.Model.NaiveBayes_Model(sample)
        return r